package yc.gg.web.controller;

import org.springframework.web.bind.annotation.*;
import yc.gg.domain.req.LoginReq;
import yc.gg.domain.req.MessageReq;
import yc.gg.domain.req.PhoneEncryptReq;
import yc.gg.service.IUserService;
import yc.gg.utils.Result;

import javax.annotation.Resource;

/**
 * \* User: Fuyue
 * \* Date: 2025/5/19
 * \* Description:
 * \
 */
@RestController
@RequestMapping("/api/user")
public class UserController {
    @Resource
    IUserService userService;

    @PostMapping("/login")
    public Result login(@RequestBody LoginReq wxLoginReq){
        return userService.login(wxLoginReq);
    }

    @PostMapping("/phone")
    public Result phone(@RequestHeader("token") String token, @RequestBody PhoneEncryptReq data) throws Exception {
        return userService.getPhone(token,data);
    }

    @PostMapping("/message")
    public Result message(@RequestBody MessageReq messageReq){
        return userService.message(messageReq);
    }

    @GetMapping("/info")
    public Result getMessage(){return userService.getMessage();}

    @PostMapping("/sign")
    public Result sign() {
        return userService.sign();
    }

    @GetMapping("/sign/count")
    public Result signCount() {
        return userService.signCount();
    }

    @GetMapping("/sign/today")
    public Result checkSignStatus() {
        return userService.checkSignStatus();
    }
}